package com.dhy.socket.request.util;

import com.dhy.socket.request.core.DhyHttpRequest;
import io.netty.handler.codec.http.DefaultFullHttpResponse;
import lombok.Data;

import java.util.Objects;


/**
 * @author 大忽悠
 * @create 2022/6/20 17:27
 */
@Data
public class RequestKey {
    private String httpMethod;
    private String url;
    private DhyHttpRequest request;
    private DefaultFullHttpResponse response;

    public RequestKey(String httpMethod, String url) {
        this.httpMethod = httpMethod;
        this.url = url;
    }

    public RequestKey(String httpMethod, String url, DhyHttpRequest request, DefaultFullHttpResponse response) {
        this.httpMethod = httpMethod;
        this.url = url;
        this.request = request;
        this.response = response;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        RequestKey that = (RequestKey) o;
        return Objects.equals(httpMethod, that.httpMethod) && Objects.equals(url, that.url);
    }

    @Override
    public int hashCode() {
        return Objects.hash(httpMethod, url);
    }
}
